using UnityEngine;
using System.Collections;

public class SliderHandler : MonoBehaviour {

	public ObjectType type;
	
	UISlider slider;
	
	void Awake(){
		
		slider = gameObject.GetComponent<UISlider>();
		
		switch(type){
		case ObjectType.Filter:
			slider.sliderValue = LevelConstants.maxFilter/10;
			break;
		case ObjectType.Mirror:
			slider.sliderValue = LevelConstants.maxMirror/10;
			break;
		case ObjectType.Mixer:
			slider.sliderValue = LevelConstants.maxMixer/10;
			break;
		case ObjectType.Divider:
			slider.sliderValue = LevelConstants.maxDivider/10;
			break;
		}
	}
	
	void OnSliderChange(float sliderValue){
		
		switch(type){
		case ObjectType.Filter:
			LevelConstants.maxFilter = Mathf.RoundToInt(sliderValue*10);
			break;
		case ObjectType.Mirror:
			LevelConstants.maxMirror = Mathf.RoundToInt(sliderValue*10);
			break;
		case ObjectType.Mixer:
			LevelConstants.maxMixer = Mathf.RoundToInt(sliderValue*10);
			break;
		case ObjectType.Divider:
			LevelConstants.maxDivider = Mathf.RoundToInt(sliderValue*10);
			break;
		}

	}

}
